﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="LogReportReceipt.ascx.cs" Inherits="ERP.Modules.LogReportReceipt" %>
<ext:Hidden ID="FormatTypeLogReceipt" runat="server" />
<%--------------GridLogReceipt-----------------%>
<ext:Panel runat="server" Layout="Fit" Border="False" ID="PanelLogReceipt">
    <Content>
        <ext:GridPanel
            ID="grLogReceipt"
            runat="server"
            Cls="grid-double"
            EnableColumnMove="true"
            Border="False">
            <Store>
                <ext:Store
                    ID="StoreLogReceipt"
                    runat="server"
                    OnReadData="StoreLogReceipt_RefreshData"
                    PageSize="20">
                    <Model>
                        <ext:Model runat="server" IDProperty="Id_log" GroupField="FullName">
                            <Fields>
                                <ext:ModelField Name="ReportReceipt_Code" Type="String" />
                                <ext:ModelField Name="Date_log" Type="Date" />
                                <ext:ModelField Name="ReportReceipt_ID" Type="Int" />
                                <ext:ModelField Name="PayerRecipientCode" Type="String" />
                                <ext:ModelField Name="Users_Id" Type="Int" />
                                <ext:ModelField Name="Employee_Id" Type="Int" />
                                <ext:ModelField Name="FullName" Type="String" />
                                <ext:ModelField Name="Reason" Type="String" />
                            </Fields>
                        </ext:Model>
                    </Model>
                </ext:Store>
            </Store>
            <ColumnModel runat="server">
                <Columns>
                    <ext:RowNumbererColumn runat="server" Width="30" Align="Center" />
                    <ext:Column runat="server" Text="Mã phiếu thu" Width="91" DataIndex="ReportReceipt_Code"></ext:Column>
                    <ext:DateColumn runat="server" Text="Ngày ghi" Width="88" DataIndex="Date_log" Format="dd-MM-yyyy" Align="Center"></ext:DateColumn>
                    <ext:DateColumn runat="server" Text="Giờ ghi" Width="122" DataIndex="Date_log" Format="hh:mm-ss" Align="Center"></ext:DateColumn>
                    <ext:Column runat="server" Text="Người mở khoá" Width="200" DataIndex="FullName"></ext:Column>
                    <ext:Column runat="server" Text="Lý do" Width="110" DataIndex="Reason">
                        <Renderer Fn="gridNull" />
                    </ext:Column>
                </Columns>
            </ColumnModel>
            <Features>
                <ext:Grouping
                    runat="server" 
                    HideGroupedHeader="true"
                    GroupByText="Xem theo phân nhóm"
                    ShowGroupsText="Phân nhóm"
                    GroupHeaderTplString="{name} ({rows.length} danh mục con {[values.rows.length > 1 ? '' : '']})"
                    StartCollapsed="True" />
            </Features>
            <SelectionModel>
                <ext:CheckboxSelectionModel runat="server" Mode="Multi">
                    <Listeners>
                       <SelectionChange Handler="
                            if (selected.length == 0) {
                                #{btnDel}.disable();
                                #{btnExport}.disable();
                            } else {
                                #{btnDel}.enable();
                                #{btnExport}.enable();
                            }" />
                   </Listeners>
                </ext:CheckboxSelectionModel>
            </SelectionModel>
            <View>
                <ext:GridView runat="server" StripeRows="true" />
            </View>
            <DockedItems>
                <ext:Toolbar runat="server" Dock="Top">
                    <Items>
                        <ext:Button ID="btnDel" runat="server" Text="Xoá" Icon="ApplicationDelete">
                            <DirectEvents>
                                <Click OnEvent="btnDel_Click">
                                    <EventMask ShowMask="true" Msg="Đang tải..." />
                                    <ExtraParams>
                                        <ext:Parameter Name="name" Value="btnDel"></ext:Parameter>
                                    </ExtraParams>
                                    <Confirmation ConfirmRequest="true"
                                        Title="Thông Báo" Message="Bạn có muốn xoá mẫu tin này không ?">
                                    </Confirmation>
                                </Click>
                            </DirectEvents>
                        </ext:Button>
                        <ext:ToolbarSeparator />
                        <ext:Button ID="btnExport" runat="server" Text="Xuất tập tin" Icon="Printer">
                            <Menu>
                                <ext:Menu ID="MenuMain" runat="server">
                                    <Items>
                                        <ext:MenuItem ID="MenuItemExportExcel" runat="server" Text="Excel" Icon="PageExcel">
                                             <DirectEvents>
                                               <Click OnEvent="MenuItemExportExcel_Click" IsUpload="true"></Click>
                                           </DirectEvents>
                                        </ext:MenuItem>
                                    </Items>
                                </ext:Menu>
                            </Menu>
                        </ext:Button>
                        <ext:ToolbarSeparator />
                        <ext:DateField ID="txtDateBeginFillter" EmptyText="Từ ngày" runat="server" MarginSpec="0 8 0 0"/>
                        <ext:DateField ID="txtDateEndFillter" EmptyText="Đến ngày" runat="server" MarginSpec="0 5 0 0"/>
                        <ext:Button ID="btnFillter" runat="server" Text="Lọc" Icon="ApplicationGo" ToolTip="Chọn lọc theo ngày đặt hàng">
                            <DirectEvents>
                                <Click OnEvent="btnFillter_Click">
                                    <EventMask ShowMask="true" Msg="Đang tải..." />
                                </Click>
                            </DirectEvents>
                        </ext:Button>
                    </Items>
                </ext:Toolbar>
                <ext:Toolbar runat="server" Dock="Bottom" AnchorHorizontal="100%">
                    <Items>
                        <ext:TriggerField ID="txtSearch" runat="server" Width="200" EnableKeyEvents="true" MarginSpec="0 8 0 0">
                            <Triggers>
                                <ext:FieldTrigger Icon="Search" />
                            </Triggers>
                            <DirectEvents>
                                <TriggerClick OnEvent="Search_Event"></TriggerClick>
                                 <SpecialKey OnEvent="Search_Event" Before="return e.getKey() == Ext.EventObject.ENTER;">
                                     <EventMask ShowMask="true" Msg="Đang tải..." />
                                </SpecialKey>
                            </DirectEvents>
                        </ext:TriggerField>
                        <ext:PagingToolbar runat="server" StoreID="StoreLogReceipt" BeforePageText="Trang" AfterPageText="của {0}" LastText="Cuối" NextText="Kế tiếp" PrevText="Trở lại" FirstText="Đầu" RefreshText="Làm tươi" DisplayInfo="true" DisplayMsg="Trang {0} - {1} của {2}" />
                    </Items>
                </ext:Toolbar>
            </DockedItems>
        </ext:GridPanel>
    </Content>
</ext:Panel>